import React from 'react'
import { Outlet, useNavigate } from 'react-router-dom'

export default function Home() {

  // 编程式路由导航
  const navigate = useNavigate()

  const musicBtnHandler = () => {
    // search 参数
    navigate('/main/home/music?music=晴天&author=杰伦')
  }

  const newsBtnHandler = () => {
    navigate('/main/home/news?news=日本首相中枪身亡！！！')
  }

  return (
    <div>
      <h3>我是Home的内容</h3>
      <button onClick={musicBtnHandler}>music</button>
      <button onClick={newsBtnHandler}>news</button>
      <Outlet />
    </div>
  )
}
